/*******************************************************************************
 * Copyright (c) 2009 Brian Edginton and Aaron Getz.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Brian Edginton - initial API and implementation
 *     Aaron Getz
 *******************************************************************************/

package org.eclipse.mylyn.internal.eplanner.ui;

import org.eclipse.mylyn.internal.eplanner.core.EPlannerCorePlugin;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

public class EPlannerUiPlugin extends AbstractUIPlugin {
	public static final String ID_PLUGIN = "org.eclipse.mylyn.eplanner.ui"; // $NON-NLS-1$
	
	private static EPlannerUiPlugin plugin;
	
	public EPlannerUiPlugin() {
		plugin = this;
	}
	
	@Override
	public void start(BundleContext context) throws Exception {
		super.start(context);
		
		TasksUi.getRepositoryManager().addListener(EPlannerCorePlugin.getDefault().getConnector().getClientManager());
		
	}
	
	@Override
	public void stop(BundleContext context) throws Exception {
		TasksUi.getRepositoryManager().removeListener(EPlannerCorePlugin.getDefault().getConnector().getClientManager());
		plugin = null;
		super.start(context);
	}
	
	public static EPlannerUiPlugin getDefault() {
		return plugin;
	}

}
